﻿using NB.MGJ.Common.Utility;
using NB.MGJ.FrameWork;
using NB.MGJ.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace NB.MGJ.Service
{
   public class LogService
    {
       private BaseRepository _baseRepository;

       public LogService()
       {
           _baseRepository = new BaseRepository();
       }

       /// <summary>
       /// 日志记录添加
       /// </summary>
       /// <param name="type">操作类别</param>
       /// <param name="typename">名称</param>
       /// <param name="contents">内容</param>
       /// <param name="ip">ip</param>
       /// <param name="user">user</param>
       public void Add(string type, string typename, string contents, string ip, LogOnUserModel user)
       {
           _baseRepository.Insert<Sys_Log>(new Sys_Log
           {
               LogTypeName = type,
               LogName = typename,
               UserName = user.LoginName,
               Contents = contents,
               CreatTime = DateTime.Now,
               LogIp = ip,
               UserId = user.UserID
           });
       }

       public IEnumerable<Sys_Log> Search(string opUser)
       {
           return null;
       }
    }
}
